import Cookies from "js-cookie"
export const getLocal = (itemName: string) => {
  return localStorage.getItem(itemName)
}
export const setLocal = (itemName: string, val: any) => {
  localStorage.setItem(itemName, JSON.stringify(val))
}
export const removeLocal = (itemName: string) => {
  localStorage.removeItem(itemName)
}
export const clearLocal = () => {
  localStorage.clear()
}

export const setCookie = (key: string, val: string, expireDay?: number) => {
  Cookies.set(key, val, { expires: expireDay || 1 })
}

export const getCookie = (key: string) => {
  return Cookies.get(key)
}
export const removeCookie = (key: string) => {
  Cookies.remove(key)
}

export const TokenKey = "access_token"